<?php
	session_start();
	if(isset($_SESSION['usuario']))
	{ $user = $_SESSION['usuario'];}
	require_once('../conexion/conexion.php');
	$rut = $_POST['rut'];

	$con = new Conexion();
	$con2 = $con->conexionBD("fpproduccion");
	$sql="select ProvRut,ProvNombre,ProvFono,ProvDireccion,ProvGiro,ProvComuna from proveedor where ProvRut='".$rut."'";
	$resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
	$datos = mysql_fetch_array($resultado);
	$con->cerrarBD();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<link href="../Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />

<script src="../include_js/jquery.js" type="text/javascript"></script>
<script src="../include_js/funciones.js" type="text/javascript"></script>

<style>
.texto2
{
	font-size:14px;
	margin-left:10px;
	font:Verdana, Arial, Helvetica, sans-serif; 
	color:#0066CC;
}
.borde
{
	/*border:0px solid #6593C0;*/
	border:1px solid #D3E4E5;
}
.asterisco
{
	color:#0000FF;
	font-weight:bold;
}
.radioBorde
{ 
 background:#D3E4E5;
 border:0px solid #89C0C7;
}
.filaPar
{
	background:#81D371; 
	font-family:Verdana, Arial, Helvetica, sans-serif; 
    font-size:11px;
	text-align:center;
	vertical-align:middle;
	padding:3px;
}
.filaImpar
{
	background:#AEF1A1;
	font-family:Verdana, Arial, Helvetica, sans-serif; 
    font-size:11px;
	text-align:center;
	vertical-align:middle;
	padding:3px;
}
</style>
<script>
function Volver()
{
	$.ajax({
				type: 'POST',
				url: 'Tabla_Proveedor.php',
				data: $('#form_edicion').serialize(),
				success: function(data) {
					$('#tabla').html(data);
				}
			})
}

function Direccionar()
{
	valor = document.getElementById('txtNum').value;
	if(valor!=0)
	{
		$.ajax({
				type: 'POST',
				url: 'Tabla_Proveedor.php',
				data: $('#form_edicion').serialize(),
				success: function(data) {
					$('#tabla').html(data);
				}
			})
	}
}

function GuardarStock()
{
	$.ajax({
				type: 'POST',
				url: 'Editar/Ingreso_Edicion_Proveedor.php',
				data: $('#form_edicion').serialize(),
				success: function(data) {
					$('#mensaje2').html(data);
					Direccionar();
				}
			})
}
</script>
</head>

<body>
<form name="form_edicion" id="form_edicion" method="post">
<div style="height:5px"></div>
<div class='option2'><label style="font:Verdana, Arial, Helvetica, sans-serif; color:#0066CC; font-weight:bold;">Edici&oacute;n de Proveedor.</label></div>
<div class='groupbox'>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="uno">
<tr>
  <td colspan="4" class="borde"><div style="height:5px;"></div></td>
</tr>
<tr>
	<td colspan="3" class="borde"><label class="texto2" style="font-weight:bold;">Datos Proveedor.</label></td>
	<td width="29%" class="borde">&nbsp;</td>
</tr>
<tr>
  <td colspan="4" class="borde">&nbsp;</td>
</tr>

<tr>
  <td width="17%" class="borde" style="text-align:right"><label class="texto2">Nombre:</label></td>
  <td width="38%" class="borde"><input type="text" name="txtNombre" id="txtNombre" size="50" readonly="true" style="background:#E1E1E1" value="<?php echo $datos[1];?>"/></td>
  <td width="16%" class="borde" style="text-align:right"><label class="texto2">Rut:</label></td>
  <td class="borde"><input type="text" name="txtRut" readonly="true" style="background:#E1E1E1" value="<?php echo $datos[0];?>"/></td>
</tr>
<tr>
  <td class="borde" style="text-align:right"><label class="texto2">Giro:</label></td>
  <td class="borde"><input name="txtGiro" type="text" id="txtGiro" size="50" value="<?php echo $datos[4];?>"></td>
  <td class="borde" style="text-align:right"><label class="texto2">Fono:</label></td>
  <td class="borde"><input type="text" name="txtFono" value="<?php echo $datos[2];?>"/></td>
</tr>
<tr>
  <td class="borde" style="text-align:right"><label class="texto2">Direcci&oacute;n:</label></td>
  <td class="borde"><input type="text" name="txtDir" size="50" value="<?php echo $datos[3];?>"/></td>
  <td class="borde" style="text-align:right"><label class="texto2">Comuna:</label></td>
  <td class="borde"><input name="txtComuna2" id="txtComuna2" type="text" value="<?php echo $datos[5];?>" /></td>
</tr>
<tr>
  <td class="borde">&nbsp;</td>
  <td class="borde"><input type="hidden" name="txtNum" /></td>
  <td class="borde">&nbsp;</td>
  <td class="borde">&nbsp;</td>
</tr>


<tr>
  <td class="borde" colspan="4"><div class="formtail"><input name="btn_Guardar" id="btn_Guardar" type="button" value=" " class="guardar"  onclick="GuardarStock();"/>
    <input type="button" name="btn_Volver" id="btn_Volver" value="Cancelar" onclick="Volver();" />
  </div></td>
</tr>
</table>
</div>
<div id="mensaje2"></div>
</form>
</body>
</html>
